{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">用户管理</div>
    <div class="layui-card-body">
        <div class="layui-form">
            <table class="layui-hide" id="currentTable" lay-filter="currentTable"></table>
        </div>
    </div>

</div>

<script type="text/html" id="barTool">

    {{#  if(d.is_auth == 1){ }}
    <a data-open='{:url("check")}?id={{ d.id }}&detail=0'
       class="layui-btn layui-btn-xs {:$auth->check('member/check')?'':'layui-hide'}" title="审核">审核</i></a>
    {{#  } }}

    <a data-open='{:url("edit")}?id={{ d.id }}&detail=1'
       class="layui-btn layui-btn-warm layui-btn-xs {:$auth->check('member/edit')?'':'layui-hide'}" title="查看详情">查看</i></a>


    <a href='{:url("del")}?id={{ d.id }}'
       class="layui-btn layui-btn-danger layui-btn-xs layui-tr-del {:$auth->check('staff.index/del')?'':'layui-hide'}">删除</i></a>


</script>

{/block}
{block name="script"}
<script type="text/javascript">
    layui.use('yznTable', function () {
        var table = layui.yznTable;
        var init = {
            table_elem: '#currentTable',
            table_render_id: 'currentTable',
            edit_url: '{:url("edit")}',
            delete_url: '{:url("del")}',
            modify_url: '{:url("multi")}',

        };

        table.render({
            init: init,
            toolbar: ['refresh'],
            url: '{:url("index")}',
            cols: yznTable.formatCols([
                [
                    {field: 'id', width: 80, title: 'ID'},
                    {
                        width: 100,
                        title: '头像',
                        align: 'center',
                        templet: "<div><img style='width: 60%;height: 100%' src='{{d.avatar}}' alt=''></div>"
                    },
                    {field: 'nickName', align: 'center', title: '昵称', searchOp: 'like'},
                    {field: 'openid', title: 'openid', search: false},
                    {field: 'total_count', title: '用户总收入', search: false},
                    {
                        field: 'is_auth',
                        align: 'center',
                        title: '认证',
                        templet: yznTable.formatter.label,
                        selectList: {0: '未认证', 1: '审核中', 2: '已认证', 3: '拒绝通过'}
                    },
                    {
                        field: 'status',
                        align: 'center',
                        width: 120,
                        title: '状态',
                        unresize: true,
                        templet: yznTable.formatter.switch,
                        tips: "正常|冻结"
                    },
                    {field: 'create_time', align: 'center', title: '创建时间', search: 'range'},
                    {fixed: 'right', align: 'center', width: 180, title: '操作', toolbar: '#barTool'}

                ]
            ], init),
            page: {}
        });
        yznTable.listenSwitch({filter: 'status', url: init.modify_url});
        yznTable.listenSwitch({filter: 'type', url: init.modify_url});

        yznTable.bindevent();
    });
</script>
{/block}